package com.net.common.util;

import com.google.common.base.Strings;

/**
 * @author  on 2017/7/18.
 * 处理模糊化的类
 */
public class FuzzyUtil {
    public static String fuzzyMobile(String mobile) {
        if (Strings.isNullOrEmpty(mobile)) {
            return "";
        }

        int length = mobile.length();
        if (length < 7) {
            return GeneratorUtil.getRepeatedString("*", length);
        }

        return mobile.substring(0, 3) + GeneratorUtil.getRepeatedString("*", length - 6) + mobile.substring(length - 3, length);
    }
}
